/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author breinesg
 */
@Entity
@Table(name = "SPECIAL_BOOK")
@XmlRootElement
@DiscriminatorValue("SBook")
@NamedQueries({
    @NamedQuery(name = "SpecialBook.findAll", query = "SELECT s FROM SpecialBook s"),
    @NamedQuery(name = "SpecialBook.findByIsbn", query = "SELECT s FROM SpecialBook s WHERE s.isbn = :isbn"),
    @NamedQuery(name = "SpecialBook.findByAuthor", query = "SELECT s FROM SpecialBook s WHERE s.author = :author")})
public class SpecialBook extends Medium implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "ISBN")
    private String isbn;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "AUTHOR")
    private String author;

    public SpecialBook() {
    }

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (mediumId != null ? mediumId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SpecialBook)) {
            return false;
        }
        SpecialBook other = (SpecialBook) object;
        if ((this.mediumId == null && other.mediumId != null) || (this.mediumId != null && !this.mediumId.equals(other.mediumId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "persistence.SpecialBook[ mediumId=" + mediumId + " ]";
    }
    
}
